import App from './App.vue';
import { author, copyright } from '../package.json';
import pinia from '@/pinia/store';
import { useRouterGuard } from '@/router/router-guard'; // 路由守卫
import { useThrottleFn } from '@vueuse/core';

import dayjs from 'dayjs';
import 'dayjs/locale/zh-cn';
import '@/styles/main/root.scss';
import '@/styles/main/dom.scss';
import '@/styles/main/element-plus-dark.scss';
import '@/styles/main/element-plus.scss';
import '@/styles/main/global.scss';
import '@/styles/main/transition.scss';
import 'virtual:svg-icons-register'; // 引入svg图标

dayjs.locale('zh-cn');

console.log(` %c  ${author}  %c ${copyright} `, 'color: #fadfa3; background: #030307; padding:5px 0;', 'color: #030307;background: #fadfa3; padding:5px 0;');

const app = createApp(App);

app.use($router).use(pinia); // 注册路由/pinia
app.mount('#app');
useRouterGuard(); // 注册路由前置守卫
/** 全局注册立即执行防抖函数 */
app.config.globalProperties.$throttle = useThrottleFn((fun: (...args: any[]) => void, ...args: any[]) => {
  fun(...args);
}, 500);

app.config.globalProperties.$dayjs = dayjs;
